package scala

import scala.io.Source

object Demo29Implicit {

  def main(args: Array[String]): Unit = {

    /**
      * 隐式转换参数
      *
      */


    def fun(str: String): String => Unit = {

      def f(per: String) = {
        println(str + "\t" + per)
      }

      f
    }


    fun("java")("后缀")


    //简写
    //函数柯里化
    def fun1(str: String)(per: String) = {
      println(str + "\t" + per)
    }

    fun1("scala")("后缀")


    /**
      * 隐式转换参数
      *
      * 方法调用的简写
      *
      */
    def fun2(str: String)(implicit per: String) = {
      println(str + "\t" + per)
    }

    //隐式转换变量
    implicit val str: String = "默认值"

    fun2("spark")
    fun2("scala")


    //y应用场景
    Source.fromFile("data/word.txt")


  }

}
